@extends('frontend/layouts/flaty_to_bootstrap')

@section('content.title')
<h1><i class="icon-list"></i> Summary</h1>
@stop

@section('content.breadcrumb.inner')
<li><a href="{{ route('home') }}"><i class="icon-home"></i> Dashboard</a><span class="divider"><i class="icon-angle-right"></i></span></li>
<li class="active">Summary</li>
@stop

@section('content.main')

<div class="row-fluid">
    <div class="span6">
        <div class="box box-gray">
            <div class="box-title">
                <h3><i class="icon-table"></i> Filter option</h3>
                <div class="box-tool">
                    <a data-action="collapse" href="#"><i class="icon-chevron-down"></i></a>
                </div>
            </div>
            <div class="box-content">
                <form action="{{ route('car_balance.main.summary') }}" class="form-horizontal" method="post">
@include('nimo.domains.car_balance.Main._form_balance_date', array('field'=>'purchase_date', 'value'=>join($filters['purchase_date'], ' to ')))
                    <div class="control-group">
                        <label class="control-label">Hudaldan avagch</label>
                        <div class="controls">
                            {{ Form::select('customer_id', $customer_list, $filters['customer_id']) }}
                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label">Service company</label>
                        <div class="controls">
                            {{ Form::select('service_company_id', $service_company_list, $filters['service_company_id']) }}
                        </div>
                    </div>

                    {{ Form::token() }}
                    <input class="btn btn-primary" type="submit" value="apply filter"/>
                </form>
            </div>
        </div>
    </div>
    <div class="span6">
        <div class="box box-blue">
            <div class="box-title">
                <h3><i class="icon-table"></i> Result details</h3>
                <div class="box-tool">
                    <a data-action="collapse" href="#"><i class="icon-chevron-down"></i></a>
                </div>
            </div>
            <div class="box-content">
                <ul class="weekly-stats">
                    <li>Total purchase cars: <span class="value">{{ $cars->count() }}</span></li>
                    <li>Total parts: <span class="value">{{ $parts->count() }}</span></li>
                </ul>
            </div>
        </div>
    </div>
</div>

@if ($cars->count())
{{-- SUMMARY --}}
<div class="row-fluid">
    <div class="span12">

@include('nimo.domains.car_balance.Summary._summary_cost', array('title'=>'PURCHASE CAR SUMMARY (COST) Services',  'summaries'=>$summaries['services']))
@include('nimo.domains.car_balance.Summary._summary_cost', array('title'=>'PURCHASE CAR SUMMARY (COST) Customers', 'summaries'=>$summaries['customers']))

@include('nimo.domains.car_balance.Summary._summary_bill', array('title'=>'PURCHASE CAR SUMMARY (BILL) Services',  'summaries'=>$summaries['services']))
@include('nimo.domains.car_balance.Summary._summary_bill', array('title'=>'PURCHASE CAR SUMMARY (BILL) Customers', 'summaries'=>$summaries['customers']))

@include('nimo.domains.car_balance.Summary._summary_parts', array('title'=>'PARTS SUMMARY - Payments',  'summaries'=>$summariesParts['services']))
@include('nimo.domains.car_balance.Summary._summary_parts', array('title'=>'PARTS SUMMARY - Customers', 'summaries'=>$summariesParts['customers']))

@include('nimo.domains.car_balance.Summary._summary_recycle',  array('title'=>'RECYCLE SUMMARY - Services',  'summaries'=>$summariesDocs['services']))

{{-- TODO INSURANCE,CONATINER --}}

    </div>
</div>


@else
    NO DATA
@endif

@stop


@section('stylesheets.more')
<link rel="stylesheet" type="text/css" href="{{ asset('assets/bootstrap-datepicker/datepicker.css') }}" />
@stop

@section('javascripts.more')
<!--page specific plugin scripts-->
<script type="text/javascript" src="{{ asset('assets/bootstrap-datepicker/datepicker.js') }}"></script>
<script type="text/javascript" src="{{ asset('assets/bootstrap-datepicker/moment.min.js') }}"></script>
<script type="text/javascript" src="{{ asset('assets/bq/balancecalendar.js') }}"></script>
<script type="text/javascript">
$('input[name=purchase_date]').balanceCalender({startMonth:9});
</script>

@stop